<div class="w400 p10">
<div class="tipbox tipbox-warning h130">
    <div class="tipbox-icon"><i class="iconfont" title="警告">&#xf05a;</i></div>
    <div class="tipbox-content"><h3 class="tipbox-title" >友情提示：每次上传只能上传一个文件</h3><p class="p10"><a href="javascript:;" id="upButton"><i class="iconfont fn-f16">&#xf03e;</i> 点击选择上传的文件</a></p></div>
</div>
</div>
<script type="text/javascript">
Do('dialog','webuploader',function(){
    var uploader = WebUploader.create({
        swf: baseDir + 'webuploader/Uploader.swf',
        server: '{url('uploads/index')}',
        pick: {id: upButton,multiple: false},
        auto: true,
        accept: {innerHTML: '点击选择文件',extensions: "jpg,png,gif,bmp"}
    });
    //上传完毕
    uploader.on('uploadSuccess',function (file,data) {
        if(data.error == 1){
            $.dialog.alert(data.message); 
        }else{
            var origin = artDialog.open.origin;
            var input = origin.document.getElementById('{$frameid}');
                input.value = data.url;
                input.select();
                $.dialog.close()
        }
    });
    uploader.on('uploadError', function (file) {
        $.dialog.alert('文件上传失败'); 
    });
})
</script>